package com.hszl.blog.controller;

import com.hszl.blog.dao.pojo.Tag;
import com.hszl.blog.service.TagService;
import com.hszl.blog.vo.Result;
import com.hszl.blog.vo.TagVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: 胡爽
 * @date: 2022/5/20 17:22
 **/
@RestController
@RequestMapping("tags")
public class TagsController {
    @Autowired
    private TagService tagService;

    @GetMapping("hot")
    public Result listHotTags(){
        int limit = 6;
        List<TagVo> tagVoList =  tagService.hot(limit);

        return Result.success(tagVoList);
    }

    @GetMapping
    public Result findAllTags(){

        return tagService.findAllTags();
    }

    @GetMapping("detail")
    public Result findAllDetailTags(){

        return tagService.findAllDetailTags();
    }
    @GetMapping("detail/{id}")
    public Result findAllDetailTagsById(@PathVariable("id") Long id){

        return tagService.findAllDetailTagsById(id);
    }
}
